import java.util.Arrays;
import java.util.Scanner;

public class Main14 {
    /**
     * 题目描述:
     * 给定n个字符串，请对n个字符串按照字典序排列。
     *
     输入
     9
     cap
     to
     cat
     card
     two
     too
     up
     boat
     boot
     输出
     boat
     boot
     cap
     card
     cat
     to
     too
     two
     up
     */
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            int next = scanner.nextInt();
            String [] ss = new String[next];
            for (int i =0; i< next; i++){
                String text = scanner.nextLine();
                ss[i] = text;
            }
            Arrays.sort(ss);
            Arrays.stream(ss).forEach(System.out::println);
        }
    }
}
